package com.admin.exam.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.admin.base.Page;
import com.admin.exam.dao.QuestionMapper;
import com.admin.exam.entity.Question;
import com.admin.exam.vo.query.QuestionQuery;

/**
* 操作相关
*/
@Service
public class QuestionService {
	@Autowired
	private QuestionMapper questionMapper;

	public Question getById(Integer id) {
		return questionMapper.getByPrimaryKey(id);
	}

	public void add(Question record) {
		questionMapper.insertSelective(record);
	}

	/**
	*批量删除
	*/
	public void delete(Integer[] ids) {
		for (Integer id : ids) {
			questionMapper.deleteByPrimaryKey(id);
		}
	}

	public void update(Question record) {
		questionMapper.updateByPrimaryKeySelective(record);
	}

	public List<Question> listByConditions(QuestionQuery query) {
		return questionMapper.listByConditions(query);
	}

	public Long pageCount(QuestionQuery query) {
		return questionMapper.pageCount(query);
	}

	public Page<Question> pagingByConditions(QuestionQuery query) {
		return questionMapper.pagingByConditions(query);
	}
}

